// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
use crate::Result;

/// Implements a [SecureSourceManager](super::stub::SecureSourceManager) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct SecureSourceManager<T>
where
    T: super::stub::SecureSourceManager + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> SecureSourceManager<T>
where
    T: super::stub::SecureSourceManager + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::SecureSourceManager for SecureSourceManager<T>
where
    T: super::stub::SecureSourceManager + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn list_instances(
        &self,
        req: crate::model::ListInstancesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListInstancesResponse>> {
        self.inner.list_instances(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_instance(
        &self,
        req: crate::model::GetInstanceRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Instance>> {
        self.inner.get_instance(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_instance(
        &self,
        req: crate::model::CreateInstanceRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_instance(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_instance(
        &self,
        req: crate::model::DeleteInstanceRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_instance(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_repositories(
        &self,
        req: crate::model::ListRepositoriesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListRepositoriesResponse>> {
        self.inner.list_repositories(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_repository(
        &self,
        req: crate::model::GetRepositoryRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Repository>> {
        self.inner.get_repository(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_repository(
        &self,
        req: crate::model::CreateRepositoryRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_repository(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_repository(
        &self,
        req: crate::model::UpdateRepositoryRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_repository(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_repository(
        &self,
        req: crate::model::DeleteRepositoryRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_repository(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_hooks(
        &self,
        req: crate::model::ListHooksRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListHooksResponse>> {
        self.inner.list_hooks(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_hook(
        &self,
        req: crate::model::GetHookRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Hook>> {
        self.inner.get_hook(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_hook(
        &self,
        req: crate::model::CreateHookRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_hook(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_hook(
        &self,
        req: crate::model::UpdateHookRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_hook(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_hook(
        &self,
        req: crate::model::DeleteHookRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_hook(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_iam_policy_repo(
        &self,
        req: iam_v1::model::GetIamPolicyRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
        self.inner.get_iam_policy_repo(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn set_iam_policy_repo(
        &self,
        req: iam_v1::model::SetIamPolicyRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
        self.inner.set_iam_policy_repo(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn test_iam_permissions_repo(
        &self,
        req: iam_v1::model::TestIamPermissionsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>> {
        self.inner.test_iam_permissions_repo(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_branch_rule(
        &self,
        req: crate::model::CreateBranchRuleRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_branch_rule(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_branch_rules(
        &self,
        req: crate::model::ListBranchRulesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListBranchRulesResponse>> {
        self.inner.list_branch_rules(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_branch_rule(
        &self,
        req: crate::model::GetBranchRuleRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::BranchRule>> {
        self.inner.get_branch_rule(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_branch_rule(
        &self,
        req: crate::model::UpdateBranchRuleRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_branch_rule(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_branch_rule(
        &self,
        req: crate::model::DeleteBranchRuleRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_branch_rule(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_pull_request(
        &self,
        req: crate::model::CreatePullRequestRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_pull_request(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_pull_request(
        &self,
        req: crate::model::GetPullRequestRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::PullRequest>> {
        self.inner.get_pull_request(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_pull_requests(
        &self,
        req: crate::model::ListPullRequestsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListPullRequestsResponse>> {
        self.inner.list_pull_requests(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_pull_request(
        &self,
        req: crate::model::UpdatePullRequestRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_pull_request(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn merge_pull_request(
        &self,
        req: crate::model::MergePullRequestRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.merge_pull_request(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn open_pull_request(
        &self,
        req: crate::model::OpenPullRequestRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.open_pull_request(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn close_pull_request(
        &self,
        req: crate::model::ClosePullRequestRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.close_pull_request(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_pull_request_file_diffs(
        &self,
        req: crate::model::ListPullRequestFileDiffsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListPullRequestFileDiffsResponse>> {
        self.inner.list_pull_request_file_diffs(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn fetch_tree(
        &self,
        req: crate::model::FetchTreeRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::FetchTreeResponse>> {
        self.inner.fetch_tree(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn fetch_blob(
        &self,
        req: crate::model::FetchBlobRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::FetchBlobResponse>> {
        self.inner.fetch_blob(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_issue(
        &self,
        req: crate::model::CreateIssueRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_issue(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_issue(
        &self,
        req: crate::model::GetIssueRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Issue>> {
        self.inner.get_issue(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_issues(
        &self,
        req: crate::model::ListIssuesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListIssuesResponse>> {
        self.inner.list_issues(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_issue(
        &self,
        req: crate::model::UpdateIssueRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_issue(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_issue(
        &self,
        req: crate::model::DeleteIssueRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_issue(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn open_issue(
        &self,
        req: crate::model::OpenIssueRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.open_issue(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn close_issue(
        &self,
        req: crate::model::CloseIssueRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.close_issue(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_pull_request_comment(
        &self,
        req: crate::model::GetPullRequestCommentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::PullRequestComment>> {
        self.inner.get_pull_request_comment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_pull_request_comments(
        &self,
        req: crate::model::ListPullRequestCommentsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListPullRequestCommentsResponse>> {
        self.inner.list_pull_request_comments(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_pull_request_comment(
        &self,
        req: crate::model::CreatePullRequestCommentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_pull_request_comment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_pull_request_comment(
        &self,
        req: crate::model::UpdatePullRequestCommentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_pull_request_comment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_pull_request_comment(
        &self,
        req: crate::model::DeletePullRequestCommentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_pull_request_comment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn batch_create_pull_request_comments(
        &self,
        req: crate::model::BatchCreatePullRequestCommentsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner
            .batch_create_pull_request_comments(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn resolve_pull_request_comments(
        &self,
        req: crate::model::ResolvePullRequestCommentsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.resolve_pull_request_comments(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn unresolve_pull_request_comments(
        &self,
        req: crate::model::UnresolvePullRequestCommentsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner
            .unresolve_pull_request_comments(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn create_issue_comment(
        &self,
        req: crate::model::CreateIssueCommentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_issue_comment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_issue_comment(
        &self,
        req: crate::model::GetIssueCommentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::IssueComment>> {
        self.inner.get_issue_comment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_issue_comments(
        &self,
        req: crate::model::ListIssueCommentsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListIssueCommentsResponse>> {
        self.inner.list_issue_comments(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_issue_comment(
        &self,
        req: crate::model::UpdateIssueCommentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_issue_comment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_issue_comment(
        &self,
        req: crate::model::DeleteIssueCommentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_issue_comment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_locations(
        &self,
        req: location::model::ListLocationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::ListLocationsResponse>> {
        self.inner.list_locations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_location(
        &self,
        req: location::model::GetLocationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::Location>> {
        self.inner.get_location(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn set_iam_policy(
        &self,
        req: iam_v1::model::SetIamPolicyRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
        self.inner.set_iam_policy(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_iam_policy(
        &self,
        req: iam_v1::model::GetIamPolicyRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
        self.inner.get_iam_policy(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn test_iam_permissions(
        &self,
        req: iam_v1::model::TestIamPermissionsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>> {
        self.inner.test_iam_permissions(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_operations(
        &self,
        req: longrunning::model::ListOperationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::ListOperationsResponse>> {
        self.inner.list_operations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_operation(
        &self,
        req: longrunning::model::DeleteOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn cancel_operation(
        &self,
        req: longrunning::model::CancelOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.cancel_operation(req, options).await
    }

    fn get_polling_error_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
        self.inner.get_polling_error_policy(options)
    }

    fn get_polling_backoff_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
        self.inner.get_polling_backoff_policy(options)
    }
}
